﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace PP
{
    public static class HtmlExtensions
    {
        public static HtmlString CmsContent(this HtmlHelper htmlHelper, int id)
        {
            return htmlHelper.Action("Details", "Content", new { id = id });
        }

        public static HtmlString CmsContent(this HtmlHelper htmlHelper, string slug)
        {
            return htmlHelper.Action("Details", "Content", new { slug = slug });
        }

        public static HtmlString CmsActionLink(this HtmlHelper htmlHelper, string linkText, int id)
        {
            return htmlHelper.ActionLink(linkText, "Index", "Content", new { id = id }, null);
        }

        public static HtmlString CmsActionLink(this HtmlHelper htmlHelper, string linkText)
        {
            var itemSlug = linkText.ToLower().Replace(' ', '-');
            return htmlHelper.ActionLink(linkText, "Index", "Content", new { slug = itemSlug }, null);
        }
    }
}